﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ADDDF.Infrastructure.Specifications
{
    public class SpecificationException : ApplicationException
    {
        private ISpecification _spec;

        public SpecificationException(ISpecification spec)
            : base("Object failed specification '" + spec.GetType().FullName + "'")
        {
            _spec = spec;
        }

        public SpecificationException(ISpecification spec, string message)
            : base("Object failed specification '" + spec.GetType().FullName + "'. " + message)
        {
            _spec = spec;
        }

        public SpecificationException(ISpecification spec, string message, Exception innerException)
            : base("Object failed specification '" + spec.GetType().FullName + "'. " + message, innerException)
        {
            _spec = spec;
        }

        public ISpecification Specification
        {
            get { return _spec; }
        }
    }
}
